home *** CD-ROM | disk | FTP | other *** search
Wrap
XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) NNNNAAAAMMMMEEEE _X_m_Q_T_t_a_k_e_s_D_e_f_a_u_l_t - A button widget holding this trait can change its appearance to show that it is the default button SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS #include <Xm/TakesDefT.h> typedef struct { int version; XmTakesDefaultNotifyProc showAsDefault; } XmTakesDefaultTraitRec, *XmTakesDefaultTrait; vvvvooooiiiidddd ((((****XXXXmmmmTTTTaaaakkkkeeeessssDDDDeeeeffffaaaauuuullllttttNNNNoooottttiiiiffffyyyyPPPPrrrroooocccc))))( WWWWiiiiddddggggeeeetttt, XXXXttttEEEEnnnnuuuummmm); VVVVEEEERRRRSSSSIIIIOOOONNNN This page documents Motif 2.1. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN You will use the _X_m_Q_T_t_a_k_e_s_D_e_f_a_u_l_t trait if you are writing a PushButton-style primitive widget or a DialogBox-style manager widget. A DialogBox widget displays several PushButton-style children. For example, a typical DialogBox widget might display three PushButton widgets: an OK button, a Cancel button, and a Help button. One of these PushButton-style children should be the default button. The default button is the PushButton-style child that is activated when the user presses <<<<RRRReeeettttuuuurrrrnnnn>>>> anywhere in the widget. (The ppppaaaarrrreeeennnntttt____pppprrrroooocccceeeessssssss method of the DialogBox is responsible for detecting the activation event.) A PushButton-style widget must be capable of altering its appearance to show that it is the default choice. Most PushButton-style widgets do this by highlighting their borders in a special way. If you are writing a PushButton-style widget, then your widget should hold the _X_m_Q_T_t_a_k_e_s_D_e_f_a_u_l_t trait. This trait announces to DialogBox widgets that the child is capable of changing its appearance to show that it is the default choice. Conversely, if you are writing a DialogBox widget, then your DialogBox widget should examine its button children for this trait. The following standard Motif primitives hold this trait: +o XXXXmmmmPPPPuuuusssshhhhBBBBuuuuttttttttoooonnnn +o XXXXmmmmPPPPuuuusssshhhhBBBBuuuuttttttttoooonnnnGGGGaaaaddddggggeeeetttt Page 1 (printed 10/3/02) XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) In addition, the EEEExxxxmmmmCCCCoooommmmmmmmaaaannnnddddBBBBuuuuttttttttoooonnnn demonstrates how to install this trait and how to define a sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method. The following standard Motif managers examine their children widgets for this trait and call the sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method: +o XXXXmmmmBBBBuuuulllllllleeeettttiiiinnnnBBBBooooaaaarrrrdddd and all its subclasses TTTThhhheeee sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt TTTTrrrraaaaiiiitttt MMMMeeeetttthhhhoooodddd vvvvooooiiiidddd sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt( WWWWiiiiddddggggeeeetttt cccchhhhiiiillllddddWWWWiiiiddddggggeeeetttt, XXXXttttEEEEnnnnuuuummmm ssssttttaaaatttteeee); Every PushButton-style widget holding the _X_m_Q_T_t_a_k_e_s_D_e_f_a_u_l_t trait must provide a sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method. The DialogBox that manages the PushButton-style widgets will call the _X_m_Q_T_t_a_k_e_s_D_e_f_a_u_l_t trait method, each time passing a different value of _s_t_a_t_e. The typical sequence of calls from the DialogBox manager is as follows: +o The DialogBox calls the sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method of each child widget, specifying a _s_t_a_t_e of XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____RRRREEEEAAAADDDDYYYY. This message tells the child to prepare to become the default button. The _M_o_t_i_f _S_t_y_l_e _G_u_i_d_edoes not mandate a particular way of handling this message, so your widget may visually do as you please. One possible response would be to increase the widget's internal margins. (Calling XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____RRRREEEEAAAADDDDYYYY helps the manager avoid future unnecessary geometry requests.) +o The DialogBox calls the sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method of the chosen default child, specifying a _s_t_a_t_e of XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOONNNN. This message tells the child to become the default button. The child must change its visual appearance in some way to show the user that it is now the default button. For example, the _E_x_m_C_o_m_m_a_n_d_B_u_t_t_o_n demonstration widget increases its shadow thickness to show that it is the default. Another widget might display some sort of icon (perhaps an arrow) to symbolize that it is the default button. +o If the default child widget changes, then the DialogBox calls the sssshhhhoooowwwwAAAAssssDDDDeeeeffffaaaauuuulllltttt trait method twice. The first call specifies a _s_t_a_t_e of XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOOFFFFFFFF in order to turn off one default button. The second call specifies a _s_t_a_t_e of XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOONNNN in order to turn on the new default button. Upon receiving the XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOOFFFFFFFF message, the child widget must change its appearance to show that it is no longer the Page 2 (printed 10/3/02) XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmQQQQTTTTttttaaaakkkkeeeessssDDDDeeeeffffaaaauuuulllltttt((((3333XXXX)))) default. XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____FFFFOOOORRRRGGGGEEEETTTT resets the visual appearance of a child widget so that it looks as it did prior to the XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____RRRREEEEAAAADDDDYYYYcall. _c_h_i_l_d_W_i_d_g_e_t Specifies the child widget holding this trait. _s_t_a_t_e Specifies one of the following states: XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____RRRREEEEAAAADDDDYYYY, XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOONNNN, XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____OOOOFFFFFFFF, and XXXXmmmmDDDDEEEEFFFFAAAAUUUULLLLTTTT____FFFFOOOORRRRGGGGEEEETTTT. RRRREEEELLLLAAAATTTTEEEEDDDD XXXXmmmmBBBBuuuulllllllleeeettttiiiinnnnBBBBooooaaaarrrrdddd(3), XXXXmmmmPPPPuuuusssshhhhBBBBuuuuttttttttoooonnnn(3), and EEEExxxxmmmmCCCCoooommmmmmmmaaaannnnddddBBBBuuuuttttttttoooonnnn(3). Page 3 (printed 10/3/02)